package com.itheima.demo;

public class Demo001 {
    public static void main(String[] args) {
        //求1-100之和;
        int sum = getSum(100);
        System.out.println(sum);
        //求5的阶乘;
        int jc = getJc(5);
        System.out.println(jc);

    }

    private static int getJc(int i) {
        if (i == 1) {
            return 1;
        } else {
            return i * getJc(i - 1);
        }
    }

    private static int getSum(int i) {
        if (i == 1) {
            return 1;
        } else {
            return i + getSum(i - 1);

        }
    }


}
